home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacAddict 123
/
MacAddict_123_2006_11.iso
/
Software
/
Utilities
/
VelaClock 1.9.wdgt
/
Scripts
/
InfoDivs.js
< prev
next >
Wrap
Text File
|
2006-08-29
|
25KB
|
796 lines
// Copyright 2005-2006, Vela Design Group. All rights reserved.
//##################################################################
//
// InfoDivs
//
//##################################################################
var infoDivBottomHeight = 4; //1 below each info item
var infoAreaTopHeight = 5; //5 22 above entire info area
var infoAreaBottomHeight = 2;//2 6 below entire info area
//infoAreaTopHeight + infoAreaBottomHeight
var sunDivIdx = 0;
var riseSetDivIdx = 1;
var moonDivIdx = 2;
var timeDivIdx = 3;
//IMPORTANT:
// 1) Literals for sunDivIdx, moonDivIdx and timeDivIdx are used in VelaClock.html
// for clickOnInfoItemTitle() and clickOnInfoItemButton().
// 2) The order of these divs needs to be the same as in VelaClock.html. This
// is so hideLastDividerBar() can hide the last divider bar.
var infoDivs = [
{id:'sunDiv', parentID:'sunDivContainer',
showing:true, fullHeight:true, inMenu:false,
arrowID: 'sunDivArrow', buttonID: 'divSunButton',
minHeight:20, maxHeight:94}, //74
{id:'riseSetDiv', parentID:'riseSetDivContainer',
showing:true, fullHeight:false, inMenu:true,
arrowID: 'riseSetDivArrow', buttonID: 'divRiseSetButton',
minHeight:34, maxHeight:127}, //prev: minHeight:36; maxHeight:124
{id:'moonDiv', parentID:'moonDivContainer',
showing:true, fullHeight:false, inMenu:false,
arrowID: 'moonDivArrow', buttonID: 'divMoonButton',
minHeight:21, maxHeight:99},
{id:'timeDiv', parentID:'timeDivContainer',
showing:true, fullHeight:true, inMenu:false,
arrowID: 'timeDivArrow', buttonID: 'divTimeButton',
minHeight:19, maxHeight:112}, //114 vc161:maxHeight:107
];
function updateDisplayOptions()
{
//tell plug-in which panes about showing/fullHeight attributes.
vtMain2.setWidgetDisplayOptions(infoDivs, infoDivs.length);
}
function setupInfoDivs()
{
//alert("###");
//alert("setupInfoDivs");
vtMain2.getWidgetDisplayOptions(infoDivs, infoDivs.length);
//Don't show last divider bar
hideLastDividerBar();
var infoHeight = 0;
var index;
var count = infoDivs.length;
for (index = 0; index < count; ++index)
{
var infoDivItem = infoDivs[index];
var divElement = document.getElementById(infoDivItem.id);
var v = infoDivItem.fullHeight ? infoDivItem.maxHeight : infoDivItem.minHeight;
divElement.setAttribute("style", "height:" + v + "px;");
if (infoDivItem.showing)
infoHeight += v + infoDivBottomHeight;
//set initial div button.
if (infoDivItem.arrowID.length > 0) {
if (infoDivItem.fullHeight)
document.getElementById(infoDivItem.arrowID).src = "Images/arrowDown.png";
else
document.getElementById(infoDivItem.arrowID).src = "Images/arrowRight.png";
}
//set on/off states for sun, rise/set, moon and time buttons.
if (infoDivItem.buttonID.length > 0) {
var buttonElem = document.getElementById(infoDivItem.buttonID);
if (infoDivItem.showing)
buttonElem.src = "Images/" + infoDivItem.buttonID + "_on.png";
else
buttonElem.src = "Images/" + infoDivItem.buttonID + "_off.png";
}
//show or hide parent div.
var subInfoDivParentElem = document.getElementById(infoDivItem.parentID);
if (infoDivItem.showing)
subInfoDivParentElem.setAttribute ('style', 'display:block;');
else
subInfoDivParentElem.setAttribute ('style', 'display:none;');
if (moonDivIdx == index) {
if (infoDivItem.fullHeight)
document.getElementById('curPhaseDot').setAttribute ("style", "visibility:hidden;");
else
document.getElementById('curPhaseDot').setAttribute ("style", "visibility:visible;");
} else if (timeDivIdx == index) {
if (infoDivItem.fullHeight) {
document.getElementById('utc_tzAbbr').setAttribute ("style", "visibility:hidden;");
document.getElementById('localTimeDiv').setAttribute ("style", "visibility:visible;");
} else {
document.getElementById('utc_tzAbbr').setAttribute ("style", "visibility:visible;");
document.getElementById('localTimeDiv').setAttribute ("style", "visibility:hidden;");
}
}
/*
if (timeDivIdx == index) {
if (infoDivItem.fullHeight)
document.getElementById('clockFace').setAttribute ("style", "display:inline-block;");
else
document.getElementById('clockFace').setAttribute ("style", "display:none;");
}
*/
//alert(index + " setup infoDivItem.id = " + infoDivItem.id);
//alert(" v = " + v);
//alert(" divElement.style.height = " + divElement.style.height);
//alert(" parseInt(divElement.style.height, 10) = " + parseInt(divElement.style.height, 10));
}
//set height of 'infoAreaContainer'
//alert("setupInfoDivs: infoHeight = " + infoHeight);
infoHeight += infoAreaTopHeight + infoAreaBottomHeight;
document.getElementById('infoAreaContainer').setAttribute("style", "height:" + infoHeight + "px;");
}
var myInfoDivItem;
function displayParent()
{
var subInfoDivParentElem = document.getElementById(myInfoDivItem.parentID);
if (myInfoDivItem.showing)
subInfoDivParentElem.setAttribute ('style', 'display:block;');
else
subInfoDivParentElem.setAttribute ('style', 'display:none;');
//alert("displayParent:" + showIt);
}
function showHideInfoDiv (infoItemIdx)
{
myInfoDivItem = infoDivs[infoItemIdx];
//IMPORTANT: myInfoDivItem is used in displayParent()
var subInfoDivParentElem = document.getElementById(myInfoDivItem.parentID);
var buttonElem = document.getElementById(myInfoDivItem.buttonID);
if (myInfoDivItem.showing) {
buttonElem.src = "Images/" + myInfoDivItem.buttonID + "_off.png";
setupInfoItemAnimation (true, true, infoItemIdx);
myInfoDivItem.showing = false;
} else {
//added for vc 181
if (window.vtMain && timeDivIdx == infoItemIdx)
setTimeout ('vtMain.refreshClockFace();', 0);
buttonElem.src = "Images/" + myInfoDivItem.buttonID + "_on.png";
myInfoDivItem.showing = true;
setupInfoItemAnimation (false, true, infoItemIdx);
}
updateDisplayOptions();
updateInfo();
}
//clickOnInfoItemButton is called when the sun, moon or time button is clicked.
function clickOnInfoItemButton(infoItemIdx)
{
showHideInfoDiv(infoItemIdx); //show or hide div
//IMPORTANT: myInfoDivItem is set in showHideInfoDiv
/*
if (myInfoDivItem.buttonID.length > 0) {
if (myInfoDivItem.showing)
document.getElementById(myInfoDivItem.buttonID).setAttribute ("style", "opacity:1.0;");
else
document.getElementById(myInfoDivItem.buttonID).setAttribute ("style", "opacity:0.5;");
}
*/
}
function clickOnInfoItemTitle(event, infoItemIdx)
{
var subInfoDiv = infoDivs[infoItemIdx];
if (subInfoDiv.fullHeight) {
//hide info item area
setupInfoItemAnimation (true, false, infoItemIdx);
subInfoDiv.fullHeight = false;
if (moonDivIdx == infoItemIdx) {
document.getElementById('curPhaseDot').setAttribute ("style", "visibility:visible;");
} else if (timeDivIdx == infoItemIdx) {
document.getElementById('utc_tzAbbr').setAttribute ("style", "visibility:visible;");
document.getElementById('localTimeDiv').setAttribute ("style", "visibility:hidden;");
}
if (subInfoDiv.arrowID.length > 0)
document.getElementById(subInfoDiv.arrowID).src = "Images/arrowRight.png";
} else {
//show info item area
subInfoDiv.fullHeight = true;
//added for vc 181
if (window.vtMain && timeDivIdx == infoItemIdx)
setTimeout ('vtMain.refreshClockFace();', 0);
setupInfoItemAnimation (false, false, infoItemIdx);
if (moonDivIdx == infoItemIdx) {
document.getElementById('curPhaseDot').setAttribute ("style", "visibility:hidden;");
} else if (timeDivIdx == infoItemIdx) {
document.getElementById('utc_tzAbbr').setAttribute ("style", "visibility:hidden;");
document.getElementById('localTimeDiv').setAttribute ("style", "visibility:visible;");
}
if (subInfoDiv.arrowID.length > 0)
document.getElementById(subInfoDiv.arrowID).src = "Images/arrowDown.png";
}
updateDisplayOptions();
updateInfo();
//switchToSunDiv(event);
//updateInfo();
}
function setupInfoAnimation (hidingDiv)
{
var infoDiv = document.getElementById('infoAreaContainer');
var timeNow = (new Date).getTime();
var multiplier = (event.shiftKey ? 10 : 1); // enable slo-mo
opacityAnimation.changeOpacity = false;
var currentInfoHeight = 0;
var index;
var count = infoDivs.length;
for (index = 0; index < count; ++index)
{
var infoDivItem = infoDivs[index];
if (infoDivItem.showing) {
//if (infoDivItem.fullHeight)
var divElement = document.getElementById(infoDivItem.id); //such as "sunDiv"
//alert(index + " anim infoDivItem.id = " + infoDivItem.id);
//alert(" divElement.style.height = " + divElement.style.height);
//alert(" parseInt(divElement.style.height, 10) = " + parseInt(divElement.style.height, 10));
currentInfoHeight += (parseInt(divElement.style.height, 10) + infoDivBottomHeight);
//alert(" currentInfoHeight = " + currentInfoHeight);
}
}
currentInfoHeight += infoAreaTopHeight + infoAreaBottomHeight;
var startingSize = parseInt(infoDiv.clientHeight,10);
//alert("infoArea: startingSize = " + startingSize);
if (hidingDiv) {
//hide the tabs
document.getElementById('divSunButton').setAttribute ("style", "display:none;");
document.getElementById('divRiseSetButton').setAttribute ("style", "display:none;");
document.getElementById('divTimeButton').setAttribute ("style", "display:none;");
document.getElementById('divMoonButton').setAttribute ("style", "display:none;");
document.getElementById('footer').setAttribute ("style", "background-image:url(Images/borderBottomNoTabs.png);");
//document.getElementById('infoKindMenu').setAttribute ("style", "display:none;");
//infoDiv.style.overflow = "hidden";
//alert("setupInfoAnimation - entering: hidingDiv");
}
else {
document.getElementById('footer').setAttribute ("style", "background-image:url(Images/borderBottom.png);");
//document.getElementById('infoKindMenu').setAttribute ("style", "display:inline-block;");
}
resizeInfoDiv.element = infoDiv;
if (resizeAnimation.timer != null) // it is moving... change to new size
{
clearInterval(resizeAnimation.timer);
resizeAnimation.timer = null;
resizeAnimation.duration -= (timeNow - resizeAnimation.startTime);
resizeInfoDiv.positionFrom = resizeInfoDiv.positionNow;
}
else
{
resizeAnimation.duration = 250 * multiplier;
resizeInfoDiv.positionFrom = startingSize;
}
if (!hidingDiv)
{
//increase widget height before showing info DIV
calcWidgetHeightAndResize();
}
resizeInfoDiv.positionTo = hidingDiv ? 0 : currentInfoHeight;
resizeAnimation.startTime = timeNow - 13; // set it back one frame.
resizeAnimation.onfinished = hidingDiv ? animHidingFinished : animShowingFinished;
//alert("#parent hidingDiv = " + hidingDiv);
//alert("positionFrom = " + resizeInfoDiv.positionFrom);
//alert("positionTo = " + resizeInfoDiv.positionTo);
resizeInfoDiv.element.style.height = startingSize;
resizeAnimation.timer = setInterval ("animate(true);", 13);
animate(true); //false
/*
if (hidingDiv)
alert("setupInfoAnimation - leaving: hiding");
else
alert("setupInfoAnimation - leaving: showing");
*/
}
//
// setupInfoItemAnimation:
// reducingHeight: true when reducing height of DIV; false when increasing height.
// hidingOrShowingDiv: true when the entire DIV is being hidden or shown
// infoItemIdx: index into global infoDivs array.
//
function setupInfoItemAnimation (reducingHeight, hidingOrShowingDiv, infoItemIdx)
{
var subInfoDiv = infoDivs[infoItemIdx];
opacityAnimation.changeOpacity = hidingOrShowingDiv;
var subInfoDivElem;
if (hidingOrShowingDiv) {
subInfoDivElem = document.getElementById(subInfoDiv.parentID);
if (reducingHeight) {
var v = (subInfoDiv.fullHeight ? subInfoDiv.maxHeight : subInfoDiv.minHeight) + infoDivBottomHeight;
subInfoDivElem.setAttribute ("style", "height:" + v + "px;");
} else {
subInfoDivElem.setAttribute ("style", "height:0;");
}
//alert("subInfoDivElem.style.height = " + subInfoDivElem.style.height);
} else {
document.getElementById(subInfoDiv.parentID).setAttribute ("style", "height:auto;");
subInfoDivElem = document.getElementById(subInfoDiv.id);
}
//var subInfoDivElem = document.getElementById(subInfoDiv.id);
var infoDiv = document.getElementById('infoAreaContainer');
var timeNow = (new Date).getTime();
var multiplier = 1;
multiplier = (shiftWasDown ? 10 : 1); // enable slo-mo
//var multiplier = (event.shiftKey ? 10 : 1); // enable slo-mo
//if (hidingOrShowingDiv)
// multiplier = 7;
//var currentInfoHeight = subInfoDiv.maxHeight;
var currentParentDivHeight = 0;
var index;
var count = infoDivs.length;
for (index = 0; index < count; ++index)
{
var infoDivItem = infoDivs[index];
//if (infoDivItem.showing)
//if (infoDivItem.fullHeight)
var divElement = document.getElementById(infoDivItem.id);
if (infoItemIdx == index) {
if (hidingOrShowingDiv) {
var h = (subInfoDiv.fullHeight ? subInfoDiv.maxHeight : subInfoDiv.minHeight) + infoDivBottomHeight;
currentParentDivHeight += reducingHeight ? 0 : h;
} else {
if (subInfoDiv.showing)
currentParentDivHeight += (reducingHeight ? subInfoDiv.minHeight : subInfoDiv.maxHeight) + infoDivBottomHeight;
}
} else {
if (infoDivItem.showing)
currentParentDivHeight += parseInt(divElement.style.height, 10) + infoDivBottomHeight;
}
}
currentParentDivHeight += infoAreaTopHeight + infoAreaBottomHeight;
//alert("parent: DivHeight = " + currentParentDivHeight);
var startingSizeParentDiv = parseInt(infoDiv.clientHeight,10);
//alert("parent: startingSize = " + startingSizeParentDiv);
var startingSize = parseInt(subInfoDivElem.clientHeight,10);
//alert("infoItem: startingSize = " + startingSize);
//Don't show last divider bar
if (hidingOrShowingDiv && !reducingHeight)
hideLastDividerBar();
/*
if (hidingOrShowingDiv) {
if (reducingHeight)
document.getElementById('sunDivBottom').setAttribute ("style", "display:none;");
else
document.getElementById('sunDivBottom').setAttribute ("style", "display:inline-block;");
}
*/
/*
if (reducingHeight) {
//hide the tabs
document.getElementById('divSunButton').setAttribute ("style", "display:none;");
document.getElementById('divTimeButton').setAttribute ("style", "display:none;");
document.getElementById('divMoonButton').setAttribute ("style", "display:none;");
document.getElementById('footer').setAttribute ("style", "background-image:url(Images/borderBottomNoTabs.png);");
//infoDiv.style.overflow = "hidden";
//alert("setupInfoAnimation - entering: reducingHeight");
}
else {
document.getElementById('footer').setAttribute ("style", "background-image:url(Images/borderBottom.png);");
}
*/
//parent div
resizeInfoDiv.element = infoDiv;
resizeInfoItemDiv.element = subInfoDivElem;
if (resizeAnimation.timer != null) // it is moving... change to new size
{
clearInterval(resizeAnimation.timer);
resizeAnimation.timer = null;
resizeAnimation.duration -= (timeNow - resizeAnimation.startTime);
resizeInfoItemDiv.positionFrom = resizeInfoItemDiv.positionNow;
opacityAnimation.from = opacityAnimation.now;
//parent div
resizeInfoDiv.positionFrom = resizeInfoDiv.positionNow;
}
else
{
resizeAnimation.duration = 250 * multiplier;
resizeInfoItemDiv.positionFrom = startingSize;
opacityAnimation.from = reducingHeight ? 1.0 : 0.70;
//parent div
resizeInfoDiv.positionFrom = startingSizeParentDiv;
}
if (!reducingHeight)
{
//increase widget height before showing(or increasing height of) subInfo and info DIV
calcWidgetHeightAndResize();
}
if (hidingOrShowingDiv) {
var h2 = (subInfoDiv.fullHeight ? subInfoDiv.maxHeight : subInfoDiv.minHeight) + infoDivBottomHeight;
resizeInfoItemDiv.positionTo = reducingHeight ? 0 : h2;
opacityAnimation.to = reducingHeight ? 0.70 : 1.0;
} else {
resizeInfoItemDiv.positionTo = reducingHeight ? subInfoDiv.minHeight : subInfoDiv.maxHeight;
}
resizeInfoDiv.positionTo = currentParentDivHeight;
//resizeInfoDiv.positionTo = reducingHeight ? (currentParentDivHeight - 28) : currentParentDivHeight;
//alert("# reducingHeight = " + reducingHeight + "; hidingOrShowingDiv = " + hidingOrShowingDiv);
//alert("parent positionFrom = " + resizeInfoDiv.positionFrom);
//alert("parent positionTo = " + resizeInfoDiv.positionTo);
//alert("item positionFrom = " + resizeInfoItemDiv.positionFrom);
//alert("item positionTo = " + resizeInfoItemDiv.positionTo);
resizeAnimation.startTime = timeNow - 13; // set it back one frame.
if (hidingOrShowingDiv)
resizeAnimation.onfinished = reducingHeight ? infoItemContainerIsNowHidden : infoItemContainerIsNowShowing;
else
resizeAnimation.onfinished = reducingHeight ? infoItemIsNotFullHeight : infoItemIsFullHeight;
resizeInfoItemDiv.element.style.height = startingSize;
if (opacityAnimation.changeOpacity)
resizeInfoItemDiv.element.style.opacity = opacityAnimation.from;
resizeAnimation.timer = setInterval ("animate(false);", 13);
animate(false); //true
}
// hide last infoDivBottom line.
function hideLastDividerBar()
{
var index;
var count = infoDivs.length;
var infoDivItem;
var lastShowingDivIndex = -1;
for (index = 0; index < count; ++index)
{
infoDivItem = infoDivs[index];
if (infoDivItem.showing)
lastShowingDivIndex = index;
}
//if (lastShowingDivIndex != -1)
for (index = 0; index < count; ++index)
{
infoDivItem = infoDivs[index];
var divElement = document.getElementById(infoDivItem.id + '_DividerBar');
if (lastShowingDivIndex == index)
divElement.setAttribute ("style", "visibility:hidden;");
else
divElement.setAttribute ("style", "visibility:visible;");
}
}
//var resizeAnimation = {startTime:0, duration:250, positionFrom:0, positionTo:0, positionNow:0, timer:null, element:null, onfinished:null};
var infoItemDuration = 250;
var resizeAnimation = {startTime:0, duration:250, timer:null, onfinished:null};
var resizeInfoDiv = {positionFrom:0, positionTo:0, positionNow:0, element:null};
var resizeInfoItemDiv = {positionFrom:0, positionTo:0, positionNow:0, element:null};
var opacityAnimation = {changeOpacity:false, to:1.0, from:0.70, now:1.0};
function limit_3 (a, b, c) {
return a < b ? b : (a > c ? c : a);
}
function computeNextFloat (from, to, ease) {
return from + (to - from) * ease;
}
function computeYAndResizeDiv (infoDivData, T, ease, callOnFinished) //isInfoItemDiv
{
var yLoc;
var newOpacity;
if (T >= resizeAnimation.duration)
{
yLoc = infoDivData.positionTo;
if (opacityAnimation.changeOpacity && callOnFinished)
newOpacity = opacityAnimation.to;
clearInterval (resizeAnimation.timer);
resizeAnimation.timer = null;
if (resizeAnimation.onfinished && callOnFinished) //!isInfoItemDiv
setTimeout ("resizeAnimation.onfinished();", 0); // call after the last frame is drawn
}
else {
yLoc = computeNextFloat(infoDivData.positionFrom, infoDivData.positionTo, ease);
if (opacityAnimation.changeOpacity && callOnFinished)
newOpacity = computeNextFloat (opacityAnimation.from, opacityAnimation.to, ease);
}
// convert to a integer, not sure if this is the best way
infoDivData.positionNow = parseInt(yLoc);
infoDivData.element.style.height = infoDivData.positionNow + "px";
if (opacityAnimation.changeOpacity && callOnFinished) {
opacityAnimation.now = newOpacity;
infoDivData.element.style.opacity = opacityAnimation.now;
}
}
function animate (isMainInfoDiv) //isInfoItemDiv
{
var T;
var yLoc;
var ease;
var time = (new Date).getTime();
//var frame;
// If isInfoItemDiv==true then we're showing or hiding one of the info items.
// Otherwise, we're showing or hiding the while info area.
var infoDivData = isMainInfoDiv ? resizeInfoDiv : resizeInfoItemDiv;
//var infoDivData = isInfoItemDiv ? resizeInfoItemDiv : resizeInfoDiv;
T = limit_3(time-resizeAnimation.startTime, 0, resizeAnimation.duration);
ease = 0.5 - (0.5 * Math.cos(Math.PI * T / resizeAnimation.duration));
if (!isMainInfoDiv) //isInfoItemDiv
computeYAndResizeDiv(resizeInfoDiv, T, ease, false); //isInfoItemDiv
computeYAndResizeDiv(infoDivData, T, ease, true); //isInfoItemDiv
}
function infoItemIsNotFullHeight()
//function animHidingFinished()
{
//alert("### infoItemIsNotFullHeight: info hidden");
//hide clock
//var infoDivItem = infoDivs[timeDivIdx];
//if (!infoDivItem.fullHeight)
// document.getElementById('clockFace').setAttribute ("style", "display:none;");
//decrease widget height after hiding(or decreasing height of) subInfo and info DIV
calcWidgetHeightAndResize();
}
function infoItemIsFullHeight()
//function animShowingFinished()
{
//alert("### infoItemIsFullHeight: info shown");
//show clock
//var infoDivItem = infoDivs[timeDivIdx];
//if (infoDivItem.fullHeight)
// document.getElementById('clockFace').setAttribute ("style", "display:inline-block;");
}
function infoItemContainerIsNowHidden()
//function animHidingFinished()
{
displayParent();
//Don't show last divider bar
hideLastDividerBar();
//decrease widget height after hiding(or decreasing height of) subInfo and info DIV
calcWidgetHeightAndResize();
}
function infoItemContainerIsNowShowing()
//function animShowingFinished()
{
displayParent();
//Don't show last divider bar
//hideLastDividerBar();
}
function animHidingFinished()
{
//alert("### animHidingFinished: info hidden");
//decrease widget height before hiding info DIV
calcWidgetHeightAndResize();
}
function animShowingFinished()
{
//alert("### animHidingFinished: info shown");
//show the tabs
document.getElementById('divSunButton').setAttribute ("style", "display:inline-block;");
document.getElementById('divRiseSetButton').setAttribute ("style", "display:inline-block;");
document.getElementById('divTimeButton').setAttribute ("style", "display:inline-block;");
document.getElementById('divMoonButton').setAttribute ("style", "display:inline-block;");
}
//---------
function enterflip(event)
{
document.getElementById('fliprollie').style.display = 'block';
//document.getElementById('infoRollie').style.display = 'block';
}
function exitflip(event)
{
document.getElementById('fliprollie').style.display = 'none';
//document.getElementById('infoRollie').style.display = 'none';
}
// variables
var flipAnimation = {
duration:0, starttime:0, to:1.0, now:0.0, from:0.0,
element0:null, element1:null, element2:null, element3:null,
element4:null, //element5:null, element6:null,
timer:null
};
var flipShown = false;
function flipAnimate()
{
var T;
var ease;
var time = (new Date).getTime();
T = limit_3(time-flipAnimation.starttime, 0, flipAnimation.duration);
if (T >= flipAnimation.duration)
{
clearInterval (flipAnimation.timer);
flipAnimation.timer = null;
flipAnimation.now = flipAnimation.to;
}
else
{
ease = 0.5 - (0.5 * Math.cos(Math.PI * T / flipAnimation.duration));
flipAnimation.now = computeNextFloat (flipAnimation.from, flipAnimation.to, ease);
}
flipAnimation.element0.style.opacity = flipAnimation.now;
flipAnimation.element1.style.opacity = flipAnimation.now;
flipAnimation.element2.style.opacity = flipAnimation.now;
flipAnimation.element3.style.opacity = flipAnimation.now;
flipAnimation.element4.style.opacity = flipAnimation.now;
}
function mousemove (event)
{
if (!flipShown)
{
// fade in the flip widget
if (flipAnimation.timer != null)
{
clearInterval (flipAnimation.timer);
flipAnimation.timer = null;
}
var starttime = (new Date).getTime() - 13; // set it back one frame
flipAnimation.duration = 500;
flipAnimation.starttime = starttime;
flipAnimation.element0 = document.getElementById ('flip');
flipAnimation.element1 = document.getElementById ('riseSetDivArrow');
flipAnimation.element2 = document.getElementById ('sunDivArrow');
flipAnimation.element3 = document.getElementById ('moonDivArrow');
flipAnimation.element4 = document.getElementById ('timeDivArrow');
flipAnimation.timer = setInterval ("flipAnimate();", 13);
flipAnimation.from = flipAnimation.now;
flipAnimation.to = 1.0;
flipAnimate();
flipShown = true;
}
}
function mouseexit (event)
{
if (flipShown)
{
// fade in the flip widget
if (flipAnimation.timer != null)
{
clearInterval (flipAnimation.timer);
flipAnimation.timer = null;
}
var starttime = (new Date).getTime() - 13; // set it back one frame
flipAnimation.duration = 500;
flipAnimation.starttime = starttime;
flipAnimation.element0 = document.getElementById ('flip');
flipAnimation.element1 = document.getElementById ('riseSetDivArrow');
flipAnimation.element2 = document.getElementById ('sunDivArrow');
flipAnimation.element3 = document.getElementById ('moonDivArrow');
flipAnimation.element4 = document.getElementById ('timeDivArrow');
flipAnimation.timer = setInterval ("flipAnimate();", 13);
flipAnimation.from = flipAnimation.now;
flipAnimation.to = 0.0;
flipAnimate();
flipShown = false;
}
}
var shiftWasDown = false;
// For id='front' add:
// onmousedown='mousedown(event);'
function mousedown (event)
{
shiftWasDown = event.shiftKey;
/*
if (event.shiftKey)
alert("mousedown: event.shiftKey is TRUE");
else
alert("mousedown: event.shiftKey is false");
*/
}